package cn.lili.controller.goods;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
import cn.lili.modules.goods.entity.vos.GoodsVO;
import cn.lili.modules.goods.service.GoodsService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(tags = "免税商品controller")
@RequiredArgsConstructor
@RequestMapping("/goods/freetax")
public class GoodsFreeTaxController {

    private final GoodsService goodsService;

    @GetMapping("/getHotSalesGoods")
    @ApiOperation("免税-热销商品-获取前20条热销商品(后期改查ES)")
    public ResultMessage<Page<GoodsVO>> getHotSalesGoods(GoodsSearchParams params) {
        return ResultUtil.data(goodsService.getHotSalesGoods(params));
    }

    @GetMapping("/getNewestGoods")
    @ApiOperation("免税-新品商品-获取上架时间50条商品(后期改查ES)")
    public ResultMessage<Page<GoodsVO>> getNewestGoods(GoodsSearchParams params) {
        return ResultUtil.data(goodsService.getNewestGoods(params));
    }


}
